package com.twentytwok.hospitalsystem22K.controller;

import com.twentytwok.hospitalsystem22K.common.R;
import com.twentytwok.hospitalsystem22K.pojo.Discussion;
import com.twentytwok.hospitalsystem22K.service.DiscussionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@CrossOrigin("*")
@RestController
@RequestMapping("/discussion")
public class DiscussionController {

    @Autowired
    private DiscussionService discussionService;

    @RequestMapping("/pageDiscussion")
    public R pageDiscussion (@RequestParam Map<String, Object> map) {
        return discussionService.pageDiscussion(map);
    }

    @RequestMapping("/addDiscussion")
    public R addDiscussion (Discussion discussion) {
        return discussionService.addDiscussion(discussion);
    }

    @RequestMapping("/deleteDiscussion")
    public R deleteDiscussionById (Integer id) {


        return discussionService.deleteDiscussionById(id);
    }

}
